package Class.Homemade.demo0525.demo4;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 姚东名
 * Date: 2024-05-25
 * Time: 22:27
 */
interface IA {
    void testA();
}
interface IB {
    void testB();
}
//接口间的继承:
interface IC extends IA, IB {
    void testC();
}

class D implements IC {

    @Override
    public void testA() {

    }

    @Override
    public void testB() {

    }

    @Override
    public void testC() {

    }
}

public class Test {
    public static void func(Animal animal) {
        animal.eat();
    }
    //测试接口：行为：飞、游泳、跑
    public static void run(IRunning iRunning) {
        iRunning.run();
    }
    public static void swimming(ISwimming iSwimming) {
        iSwimming.swim();
    }
    public static void fly(IFly iFly) {
        iFly.fly();
    }
    public static void main2(String[] args) {
        //传参 -> 向上转型
        run(new Dog("旺财", 19));
        System.out.println("======");

        fly(new Duck("唐老鸭", 11));
        System.out.println("======");

        swimming(new Fish("小鱼儿", 15));
        System.out.println("======");
    }
    public static void main1(String[] args) {
        //传参，发生向上转型
        func(new Dog("旺财", 19));
        func(new Fish("小鱼儿", 15));
        func(new Duck("唐老鸭", 11));
    }
}
